﻿<%@ Page Title="" Language="C#" MasterPageFile="~/GUI/User/UserChiTiet.master" AutoEventWireup="true" CodeBehind="TimKiem.aspx.cs" Inherits="ProjectWebNhac.GUI.User.TimKiem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script src="js/FancyBox/source/jquery.fancybox.js" type="text/javascript"></script>
    <link href="js/FancyBox/source/jquery.fancybox.css" rel="stylesheet" type="text/css" />
    <script src="js/FancyBox/source/jquery.fancybox.pack.js" type="text/javascript"></script>
    <script src="js/FancyBox/lib/jquery.mousewheel-3.0.6.pack.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var tempSong = '';

        $('.nologin').showPopup({
            top: 50,
            closeButton: ".close_popup",
            scroll: false,
            onClose: function () {
            }
        });
        $(".add").fancybox({
            'scrolling': 'no',
            'titleShow': false,
            width: 440,
            height: 340,
            'onClosed': function () {
                $("#login_error").hide();
            }
        });
        $('.add').on("click", function () {
            tempSong = $(this).text();
        });
        var dropPlaylist = $('#<%=dropPlaylist.ClientID %>');
        $("#btnAdd").on("click", function () {
            if (dropPlaylist.val() == "-1") {
                alert("Vui lòng chọn playlist");
            } else {
                AddtoPlaylist();
            }
        });
        $("#btnCreate").on("click", function () {

            if ($('#txtPlaylist').val() == "" || $('#txtPlaylist').val() == null) {
                alert("Vui lòng đặt tên playlist");
            } else {
                CreateNewPL();
            }

        });
        function AddtoPlaylist() {
            var data = "{ 'MaPL': '" + dropPlaylist.val() + "','MaBaiHat':'" +
                 tempSong + "'}";
            $.ajax({
                type: "POST",
                url: "BaiHat.aspx/AddPlayList",
                data: data,
                contentType: "application/json",
                dataType: "json",
                success: function (msg) {
                    if (msg.d) {
                        alert("Thêm bài hát thành công");
                        $.fancybox.close();
                    } else {
                        alert("Bài hát này đã tồn tại");
                    }


                    // Replace the div's content with the page method's return.

                }
            });
        }
        var taikhoan = $('#<%=txtUserName.ClientID%>');
        function CreateNewPL() {
            var data = "{ 'tenPlaylist': '" + $('#txtPlaylist').val() + "','taikhoan':'" +
                 taikhoan.val() + "'}";
            $.ajax({
                type: "POST",
                url: "BaiHat.aspx/CreateNewPL",
                data: data,
                contentType: "application/json",
                dataType: "json",
                success: function (msg) {
                    if (msg.d != "failed") {
                        alert("Thêm playlist thành công");
                        dropPlaylist.append("<option value='" + msg.d +
                            "'>" + $('#txtPlaylist').val() + "</option>");
                        $('#txtPlaylist').val("");
                        $.fancybox.close();
                    } else {
                        alert("Tên playlist này đã tồn tại");
                    }

                }
            });
        }
    });
    </script>
<div class="span9 news no-margin homepage">
                        <div class="main-top span9 tracks-page">
                            <div class="span9 no-margin">
                                <h1>15 kết quả tìm thấy cho từ khóa 
                                    <asp:Label ID="lbKeyword" runat="server" Text="Mỹ Tâm" ForeColor="#000099"></asp:Label></h1>
                                <div class="options-line">
                                    <div class="breadcrumb-container" style="margin-bottom:15px">
                                        <ul class="breadcrumb">
                                            <li><a href="TrangChu.aspx">Trang Chủ</a> <span class="divider">»</span></li>
                                            <li class="active">Tìm Kiếm</li>
                                        </ul>
                                    </div>
                                    
                                    <div class="tabs hidden-phone">
                                        <asp:LinkButton ID="lnkCaSi" runat="server" CssClass="active" onclick="lnkCaSi_Click">Ca Sĩ</asp:LinkButton>
                                        <asp:LinkButton ID="lnkBaiHat" runat="server" onclick="lnkBaiHat_Click">Bài Hát</asp:LinkButton>
                                        <asp:LinkButton ID="lnkAlbum" runat="server" onclick="lnkAlbum_Click">Album</asp:LinkButton>
                                        <asp:LinkButton ID="lnkVideo" runat="server" onclick="lnkVideo_Click">Video</asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </div>

<div  id="divCaSi" runat="Server">
<div class="tracks span9">
                            <div class="span9 no-margin online-player album-article">
                            <h1>Ca Sĩ</h1>
                            <hr/>
                            <div class='new-albums grid'>
                                <asp:Repeater ID="reCaSi" runat="server">
                                <ItemTemplate>
                                       <div class='new-album-box' style="width: 217px;">
                                <div class='inner'>
                                    <figure>

                                        <img style="height:100px;width:100px" src='../../HinhAnh/CaSi/<%#Eval("HinhAnh") %>' alt='' />
                                    </figure>
                                    <div class='details'>
                                        <h2><a href='ChiTietCaSi.aspx?MaCaSi=<%#Eval("MaCaSi") %>'><%#Eval("TenCaSi") %></a></h2>
                                        <p>
                                            N/A
                                        </p>
                                    </div>
                                    <div class='options'>
                                        <span class='price'> Ngày sinh: <%#Eval("NgaySinh")%> </span>
                                        <span class='price'> Công ty: <%#Eval("CongTyDaiDien") %> </span>
                                        
                                    </div>
                                </div>
                            </div>
                                </ItemTemplate>
                                </asp:Repeater>
                      
                        </div>
                        </div>
  
</div>
  <div class="standard-pagination">
                            <ul>
                                <%--<li class="active"><a href="#" class="btn">1</a></li>
                                <li><a href="#" class="btn">2</a></li>--%>
                                
                                <asp:Literal ID="liCaSi" runat="server"></asp:Literal>
                            </ul>
                        </div>
</div>

<div id="divBaiHat" runat="Server" class="tracks span9" visible=false>
                            <div class="wrapper-search" style="border-top:solid 1px">
                            <div class='song'><h1>Danh Sách Bài Hát</h1></div>
                                <asp:Repeater ID="reSearch" runat="server" onitemdatabound="reSearch_ItemDataBound" >
                                <ItemTemplate>
                                     <div class='track-line'>
                                     <div class='span6 no-margin'>
                                   
                                    <div class="jp-audio custom" id="jp_container_1">
                                        <div class="jp-type-single">
                                            <div class="jp-gui jp-interface">
                                                
                                                <div class='name'>
                                                    <div class="jp-title">
                                                        <ul>
                                                            <li><a href="ChiTietBaiHat.aspx?MaBH=<%#Eval("MaBaiHat") %>"><%#Eval("TenBaiHat") %></a> </li>
                                                            <li>Trình bày : 
                                                                <asp:Repeater ID="reCasi" runat="server">
                                                                <ItemTemplate>
                                                                    <a href="ChiTietCaSi.aspx?MaCS="<%#Eval("MaCaSi") %>><%#Eval("TenCaSi") %></a>  
                                                                </ItemTemplate>
                                                                </asp:Repeater>
                                                            
                                                            
                                                            | <a href="#"><%#Eval("TenTheLoai") %></a></li>
                                                            <li>Đăng bởi : <a href="#"><%#Eval("TaiKhoan") %></a> | Ngày đăng: <%#Eval("NgayThem", "{0:dd/MM/yyyy}")%> | Lượt nghe: <%#Eval("LuotNghe") %></li>
                                                        </ul>
                                                    </div>
                                                    
                                                </div>
                                                <div class='right'>
                                                     <%if (Session["ThanhVien"] != null)
                                              {
                                                %>
                                                 <a href='#playlistAdd' class='add'><%#Eval("MaBaiHat") %></a>
                                                <%  
                                              }
                                              else
                                              { %>
                                           <a  href="#popup_login" class='nologin'><%#Eval("MaBaiHat") %></a>
                                           <%} %>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                    </div>
                                    </ItemTemplate>
                                </asp:Repeater>

                            </div>
                            <div class="standard-pagination">
                            <ul>
                                <%--<li class="active"><a href="#" class="btn">1</a></li>
                                <li><a href="#" class="btn">2</a></li>--%>
                                
                                <asp:Literal ID="liPage" runat="server"></asp:Literal>
                            </ul>
                        </div>
                            </div>

<div id="divAlbum" runat="Server" class="span9 news no-margin homepage" visible=false>
                            <h1>Album</h1>
                            <hr/>
            <asp:Repeater ID="reAlbum" runat="server">
            <ItemTemplate>
             <article class="span3">
                                <div class="inner">
                                    <figure>
                                        <img src="../../HinhAnh/Album/<%#Eval("HinhAnh") %>" alt="">
                                    </figure>
                                    <h2><a href="ChiTietAlbum.aspx?MaAlbum=<%#Eval("MaAlbum") %>"><%#Eval("TenAlbum") %></a></h2>
                                    <p>
                                       <%#Eval("MoTa2").ToString()%>
                                    </p>
                                </div>
                                <div class="bottom">
                                    <a class="comments">0</a>

                                    <div class="star-rating">
                                        <a href="#" title="1 star" class="full">1 star</a>
                                        <a href="#" title="2 stars" class="full">2 stars</a>
                                        <a href="#" title="3 stars" class="full">3 stars</a>
                                        <a href="#" title="4 stars" class="full">4 stars</a>
                                        <a href="#" title="5 stars" class="empty">5 stars</a>
                                    </div>
                                </div>
                            </article>
            </ItemTemplate>
            </asp:Repeater>
             
            <div class="standard-pagination">
                            <ul>
                                <%--<li class="active"><a href="#" class="btn">1</a></li>
                                <li><a href="#" class="btn">2</a></li>--%>
                                
                                <asp:Literal ID="liAlbum" runat="server"></asp:Literal>
                            </ul>
                        </div>

</div>


<div  id="divVideo" runat="Server" class="span9 news no-margin homepage" visible=false>
                            <h1>Video </h1>
                            <hr>
                        <div class="mostcontainer">
                	<ul>
                        
                        <asp:Repeater ID="reVideo" runat="server">
                        <ItemTemplate>
                          <li>  
                        	<div class="vediodiv" style="padding-top: 0px;">
                            	<a href="ChitietVideo.aspx?MaVideo=<%#Eval("MaVideo") %>"><img src="../../HinhAnh/Video/<%#Eval("AvatarClip") %>" alt="" style=" height: 102px;    width: 200px;">

                                	<span class="time"><%#Eval("Timespan") %></span>
                                </a>
                            &nbsp;&nbsp;</div>
                        	<div class="clear"></div>
                        	<p class="ttle" style="margin-bottom: 0px;"><a class="colr2" href="ChitietVideo.aspx?MaVideo=<%#Eval("MaVideo") %>"><%#Eval("TenVideo") %></a></p>
                            <p class="ttle" style="margin-bottom: 0px;">
                            
                            <a class="colr2" href="ChiTietCaSi.aspx.aspx?MaCaSi=71">2NE1.</a>

                            </p>
							<p class="viewcounts"><%#Eval("LuoTXem") %> lượt xem</p>
							<p>Đăng Bởi: <a href="#" class="undrlne"><%#Eval("TaiKhoan") %></a></p>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    	
                    </ul>
                </div>
                <div class="standard-pagination">
                            <ul>
                                <%--<li class="active"><a href="#" class="btn">1</a></li>
                                <li><a href="#" class="btn">2</a></li>--%>
                                
                                <asp:Literal ID="liVideo" runat="server"></asp:Literal>
                            </ul>
                        </div>
                        </div>

</div>

       <div style="display:none;width:300px;height:200px" id="playlistAdd" >
	
	    	        <p id="login_error">Thêm bài hát vào playlist</p>
		                     <p>
			<label for="login_name" style="width:100px;float:left">Chọn playlist: </label>
            <asp:DropDownList ID="dropPlaylist" style="margin-top: -3px;width: 190px;" runat="server">
            </asp:DropDownList>
		</p>
		                     <p>
			<input type="button" class="registration btn btn-blue" value="Thêm" id="btnAdd" />
		</p>
	                         <p>
            <label for="login_name" style="width:80px;float:left">Tên Playlist </label>
            <input type="text" id="txtPlaylist"/>
        </p>
                             <p>
			<input type="button" class="registration btn btn-blue" value="Tạo mới playlist" id="btnCreate" />
		</p>
                    </div>

                    
                        <asp:TextBox style="display:none" ID="txtUserName" runat="server" Text=""></asp:TextBox>
                       
</asp:Content>
